import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;

public class SimpleObserver implements Observer<String> {

    Disposable disposable;
    @Override
    public void onSubscribe(Disposable d) {
        disposable = d;
    }

    @Override
    public void onNext(String s) {
        s = s + "-......" + s;
        System.out.println(s);
    }

    @Override
    public void onError(Throwable e) {

    }

    @Override
    public void onComplete() {
        System.out.println("completed.");
        if( disposable!=null) {
            System.out.println("disposed");
            disposable.dispose();
        }

    }
}
